/* $Header: error.h,v 2.3 03/03/20 11:02:27 przybyls Exp $ */

/***********************************************************************/
/* INCLUDE FILE NAME:  error.h                                         */
/* ==================                                                  */
/*                                                                     */
/* Author:   Lesley Freed                                              */
/*                                                                     */
/* COMMENT:  Contains the error typedefs.                              */
/*                                                                     */
/*                                                                     */
/*                                                                     */
/*                                                                     */
/***********************************************************************/

#ifndef ERROR_H
#define ERROR_H

/*****************************/
/*   IFDEFS                  */
/*****************************/


/*****************************/
/*   SYMBOLIC CONSTANTS      */
/*****************************/

/*****************************/
/*   MACROS                  */
/*****************************/

#define CLEAR_ANALOG_LOOP_BACK_ERRS()                                 \
{                                                                     \
   ClearException(ATTN1_TEST_FAILED);                                 \
   ClearException(ATTN2_TEST_FAILED);                                 \
   ClearException(DAC1_TEST_FAILED);                                  \
   ClearException(DAC2_TEST_FAILED);                                  \
}                                                                     \

/*****************************/
/*   TYPEDEFS                */
/*****************************/

#define SIGNAL_DSP_LOAD_OK 0x0f /* Indicates the DSP load is OK, anything     */
                                /* else indicates an error.                   */

/*  Define the response codes for user-interface validate/check commands      */

typedef enum
{
   OK              = 0,
   PARAM_TOO_LARGE = 1,
   PARAM_TOO_SMALL = 2,
   INVALID_PARAM   = 3,  /* wrong param type (number vs alpha vs boolean-0or1)*/
   NO_INSTR        = 4,  /* no instruction was found in input msg */
   INSTR_SYNTAX    = 5,  /* beginning of instr was found but not complete */
   INVALID_DEST    = 6,  /* instruction syntax was OK but dsap was unknown */
   INVALID_OP      = 7,  /* the operation specified in the cmd is invalid */
   PARAM_LENGTH    = 8,  /* max len of all param (MAX_PARM_LEN) was exceeded */
   NUM_OF_PARAM    = 9,  /* max number of param. (MAX_PARM_NUN) was exceeded */
   MISSING_PARAM   = 10, /* required param. was not present */
   PARAM_SYNTAX    = 11,  /* non printing char found in parameter */
   SYNTAX_ERROR    = 12, /* syntax error in the command */
   NOT_INSTALLED   = 13,
   NOT_ALLOWED     = 14, /* param is valid, but not allowed in this case */
   NOT_COMPATIBLE  = 15, /* param is not compatible with hardware installed */
   OVEN_GT_MAX     = 16, /* Oven temp > Oven Maximum param */
   INIT_GT_MAX     = 17, /* Oven init temp > Oven maximum param */
   FINAL1_GT_MAX   = 18, /* Oven final temp 1 > Oven maximum param */
   FINAL2_GT_MAX   = 19, /* Oven final temp 2 > Oven maximum param */
   FINAL3_GT_MAX   = 20, /* Oven final temp 3 > Oven maximum param */
   FINAL4_GT_MAX   = 21, /* Oven final temp 4 > Oven maximum param */
   FINAL5_GT_MAX   = 22, /* Oven final temp 5 > Oven maximum param */
   FINAL6_GT_MAX   = 23, /* Oven final temp 6 > Oven maximum param */
   OVEN_CALIB_MAX  = 24, /* Oven calibration value higher than max */
   OVEN_CALIB_MIN  = 25, /* Oven calibration value lower than max  */
   PARAM_CHANGED   = 26, /* One or more parameters were modified */
   NOT_VALID_DURING_RUN = 27,     /* Cannot be excuted when gc is in a run */
   NOT_VALID_DURING_SCC_RUN = 28, /*Cannot be excuted when gc is in an scc run*/
   SCC_RUN_LENGTH_TOO_SHORT = 29, /* Run length too short to do a blank run */
   NO_SCC_DATA         = 30, /* No column compensation data stored for ccomp1 or 2*/
   NOT_VALID_IN_OVEN_TRACK_MODE = 31,/*Cannot set the temp while in track mode*/
   SCC1_DET_SETPT      = 32, /* Col comp1 setpt det setpt is set to NULL_POSITION */
   SCC2_DET_SETPT      = 33, /* Col comp2 setpt det setpt is set to NULL_POSITION */
   FRONT_DET_OFF       = 35, /* Front detector board is OFF                   */
   BACK_DET_OFF        = 36, /* Back detector board is OFF                    */
   TABLE_FULL          = 37, /* Run/Clock/? table full                        */
   TABLE_ENTRY_EMPTY   = 38, /* attempt to read an empty table entry          */
   WRONG_VERSION       = 39, /* Sequence/Method invalid version # */
   CORRUPTED_MEMORY    = 40, /* Local (IQ) stored sequence/method corrupt     */
   LINK_ERROR          = 41, /* Data Comm Link error */
   LINK_ABNORMAL_BREAK = 42, /* abnormal break in communications */
   LINK_DATA_ERROR     = 43, /* data error (parity, framing etc) */
   LINK_OVERRUN        = 44, /* data overrun error; data lost */
   TEST_PASSED         = 45, /* requested test passed */
   TEST_FAILED         = 46, /* requested test failed */
   SAMPLER_OFFLINE     = 47, /* ALS not responding    */
   COMMAND_ABORTED     = 48, /* cmd error - subsequent parameters ignored (IXSP IXPP CxNR ) */
   TIME_OUT            = 49, /* instruction timed out due to error in system */
   PARAM_ABORTED       = 50, /* parameter was judged invalid and ignored, remainder of command continued (GCPO) */
   INVALID_PATH        = 51, /* a pass thru cmd was found with path not set up or path is in use by another datacomm port. */
   EXCEEDS_CALIB_RANGE = 52, /* calibration would cause too much of a correction, attempt disallowed */
   OUTSIDE_ALLOWED_RANGE=53, /* attempted calibration too far away from span */
   IN_PROGRESS          =54, /* still calibrating (flow sensor offset) try checking again */
   PCB_CMD_FAILED       =55, /* command sent to pcb2 did not work. */
   POST_TEMP_GT_MAX     =56, /* post temp setpt greater than max setpt */
   OTHER_CRYO_CONFIGURED=57, /* another small zone or the oven is configured */
                             /* with a different cryo type                   */
   UNSUPPORTED_CRYO_TYPE=58, /* this zone does not support this cryo type    */
   CRYO_VALVE_CONFLICT  =59, /* another zone is using the cryo valve drive   */

   PURGE_TIME_CONFLICT  =60, /* Purge_Time is .LE. Sampling_End (VI only)    */
   MISER_TIME_CONFLICT  =61, /* Saver_Time is .LE. Sampling_End (VI only)    */
   COL_TIME1_CONFLICT   =62, /* Col_Init_Time .LE. Sampling_End (VI only)    */
   IGNORE_SETPTS        =63, /* Flag to reject the command's setpoints w/out */
                             /*   logging an error in the command error log  */


/*********************************************************************/
/************** Special codes for flash memory ***********************/
/*********************************************************************/

   FLASH_BUF_UNLOCKED   =90, /* Flash ROM buffer has been successfully unlocked */
   FLASH_ROM_FAILURE    =91, /* Flash ROM failure to erase or program           */
   FLASH_BUF_OVFLO      =92, /* attempt to program past the end of the buffer   */
   FLASH_BUF_INVALID    =93, /* invalid header block in flash buffer            */
   FLASH_DATA_INVALID   =94, /* corrupt or invalid data in flash buffer         */


/*********************************************************************/
/**************  Special test codes for pneumatics *******************/
/*********************************************************************/

   OVFLOW_V25C          =500,  /* defined in pi_mcalib.c, used by pneu manufacting calib cmds */
   OVFLOW_DT            =501,  /* defined in pi_mcalib.c, used by pneu manufacting calib cmds */
   OVFLOW_DV            =502,  /* defined in pi_mcalib.c, used by pneu manufacting calib cmds */
   ZERO_DV              =503,  /* defined in pi_mcalib.c, used by pneu manufacting calib cmds */
   OVFLOW_PS_OFFSET     =504,  /* defined in pi_mcalib.c, used by pneu manufacting calib cmds */
   OVFLOW_PS_SPAN       =505,  /* defined in pi_mcalib.c, used by pneu manufacting calib cmds */
   OVFLOW_PS_DOFFSET    =506,  /* defined in pi_mcalib.c, used by pneu manufacting calib cmds */
   OVFLOW_PS_DSPAN      =507,  /* defined in pi_mcalib.c, used by pneu manufacting calib cmds */
   ZERO_PS_RANGE        =508,  /* defined in pi_mcalib.c, used by pneu manufacting calib cmds */
   ZERO_PS_DCM2         =509,  /* defined in pi_mcalib.c, used by pneu manufacting calib cmds */
   ZERO_PS_OFFSET       =510,  /* defined in pi_mcalib.c, used by pneu manufacting calib cmds */
   ZERO_PS_SPAN         =511,  /* defined in pi_mcalib.c, used by pneu manufacting calib cmds */
   OVFLOW_FS_ALPHA_HIGH =512,  /* defined in pi_mcalib.c, used by pneu manufacting calib cmds */
   OVFLOW_FS_ALPHA_LOW  =513,  /* defined in pi_mcalib.c, used by pneu manufacting calib cmds */
   OVFLOW_FS_BETA_HIGH  =514,  /* defined in pi_mcalib.c, used by pneu manufacting calib cmds */
   OVFLOW_FS_BETA_LOW   =515,  /* defined in pi_mcalib.c, used by pneu manufacting calib cmds */
   OVFLOW_FS_OFFSET     =516,  /* defined in pi_mcalib.c, used by pneu manufacting calib cmds */
   OVFLOW_FS_REF_TEMP   =517,  /* defined in pi_mcalib.c, used by pneu manufacting calib cmds */
   OVFLOW_FS_MAX_FLOW   =518,  /* defined in pi_mcalib.c, used by pneu manufacting calib cmds */
   OVFLOW_FS_DALPHA     =519,  /* defined in pi_mcalib.c, used by pneu manufacting calib cmds */
   OVFLOW_FS_DBETA      =520,  /* defined in pi_mcalib.c, used by pneu manufacting calib cmds */
   OVFLOW_FS_DOFFSET    =521,  /* defined in pi_mcalib.c, used by pneu manufacting calib cmds */
   ZERO_FS_OFFSET       =522,  /* defined in pi_mcalib.c, used by pneu manufacting calib cmds */
   ZERO_FS_ALPHA_LOW    =523,  /* defined in pi_mcalib.c, used by pneu manufacting calib cmds */
   ZERO_FS_BETA_LOW     =524,  /* defined in pi_mcalib.c, used by pneu manufacting calib cmds */
   BAD_SWITCH_FLOW      =525,  /* defined in pi_mcalib.c, used by pneu manufacting calib cmds */
   OVFLOW_PURGE_FLOW    =526,  /* defined in pi_mcalib.c, used by pneu manufacting calib cmds */
   OVFLOW_DF_DP         =527,  /* defined in pi_mcalib.c, used by pneu manufacting calib cmds */
   ZERO_PURGE_FLOW      =528,  /* defined in pi_mcalib.c, used by pneu manufacting calib cmds */
   INVALID_GAS          =529,  /* defined in pi_mcalib.c, used by pneu manufacting calib cmds */
   EEPROM_WRITE_ERROR   =530,  /* defined in pi_mcalib.c, used by pneu manufacting calib cmds */
   EEPROM_READ_ERROR    =531,  /* defined in pi_mcalib.c, used by pneu manufacting calib cmds */
   INAPPROPRIATE_MODULE =532   /* defined in pi_mcalib.c, used by pneu manufacting calib cmds */

} UI_ERR;

/*****************************/
/*   EXTERNS                 */
/*****************************/

/*****************************/
/*   FUNCTION PROTOTYPES     */
/*****************************/

/* statmon/monitor.c functions */
void    LogNotReadyRunDeviations( void );

/* statmon/stat_init.c functions */
void    InitializeStatusMonitor( void );

#endif
